<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : DetailedLesson_user.xsl
    Created on : July 15, 2013, 3:38 PM
    Author     : NamDH
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
         xmlns:detail="http://xml.netbeans.org/schema/DetailedLessions"
         xmlns:lessonlist="http://xml.netbeans.org/schema/lessonList">
    <xsl:output method="html" encoding="UTF-8" />
    <xsl:param name="lId"/>
    <xsl:param name="lessonlist"/>
    <xsl:param name="type"/>
    <xsl:variable name="lessonlistdoc" select="document($lessonlist)"/>

    <!-- TODO customize transformation rules
         syntax recommendation http://www.w3.org/TR/xslt
    -->
    <xsl:template match="/">
        <html>
            <body>
                <xsl:apply-templates/>
            </body>
        </html>
    </xsl:template>

    <xsl:template match="detail:DetailedLessons">
        <div id="page">
            <div id="wrap" class="divwraphead">
                <div id="top">
                    <div id="N_title">
                        <div id="left-title">
                        </div>
                        <div id="right-title" style="">
                            <div id="text-right-title">Tên bài</div>
                        </div>
                        <div id="lessonName">
                           <xsl:value-of select="$lessonlistdoc//lessonlist:lessonList[lessonlist:lessonId=$lId]/lessonlist:lessonName"/>
                           <xsl:if test="not ($type = 0)">
                               <xsl:choose>
                                   <xsl:when test="$type='tuvung'">
                                       <xsl:text>(TỪ VỰNG)</xsl:text>
                                   </xsl:when>
                                   <xsl:when test="$type='nguphap'">
                                       <xsl:text>(NGỮ PHÁP)</xsl:text>
                                   </xsl:when>
                                   <xsl:when test="$type='luyendoc'">
                                       <xsl:text>(LUYỆN ĐỌC)</xsl:text>
                                   </xsl:when>
                                   <xsl:when test="$type='hoithoai'">
                                       <xsl:text>(HỘI THOẠI)</xsl:text>
                                   </xsl:when>
                                   <xsl:when test="$type='luyennghe'">
                                       <xsl:text>(LUYỆN NGHE)</xsl:text>
                                   </xsl:when>
                                   <xsl:when test="$type='baitap'">
                                       <xsl:text>(BÀI TẬP)</xsl:text>
                                   </xsl:when>
                                   <xsl:when test="$type='hantu'">
                                       <xsl:text>(HÁN TỰ)</xsl:text>
                                   </xsl:when>
                                   <xsl:when test="$type='luyentap'">
                                       <xsl:text>(LUYỆN TẬP)</xsl:text>
                                   </xsl:when>
                                   <xsl:otherwise></xsl:otherwise>
                               </xsl:choose>                              
                           </xsl:if>
                        </div>
                    </div>
                </div>
                <div id="mid">
                    <div id="tabbed_section">
                        <div id="menu">
                            <ul id="ul_tabs">
                                <xsl:for-each select="detail:DetailedLesson">
                                    <xsl:variable name="counter">
                                        <xsl:number value="position()"/>
                                    </xsl:variable>
                                    <li class="lh" id="t{$counter}" onClick="change('tab{$counter}')">
                                        <xsl:value-of select="detail:Part"/>
                                    </li>                  
                                </xsl:for-each>
                            </ul>
                        </div>

                        <xsl:variable name="count">
                            <xsl:value-of select="count(detail:DetailedLesson)"/>
                        </xsl:variable>

                        <input id="countvalue" name="countvalue" type="hidden" value="{$count}"/>

                        <div id="Display_content" onload="change('h1')">
                        </div>
                        <xsl:for-each select="detail:DetailedLesson">
                            <xsl:variable name="counter">
                                <xsl:number value="position()"/>
                            </xsl:variable>
                         
                            <div id="tab{$counter}" class="content_tab" style="clear: both;">
                                <div style="margin-top: 5px; margin-left:5px"> 
                                     
                                    <xsl:value-of select="detail:Substance" disable-output-escaping="yes"/>
                                </div>
                            </div>                        
                        </xsl:for-each>
                    </div>
                </div>
            </div>
        </div>
    </xsl:template>

</xsl:stylesheet>
